<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <div id="app"></div>
    <div id="app1"></div>
    <div id="app2"></div>
    <script src="../js/babel.min.js"></script>
    <script src="../js/react.development.js"></script>
    <script src="../js/react-dom.development.js"></script>
    <script src="../js/prop-types.js"></script>
    <script type="text/babel">
      class Demo extends React.Component {
        showData = () => {
          //   const leftInput = document.getElementById("input1").value;
          //   alert(leftInput);
          alert(this.refs.ref1.value);
        };
        blurData = () => {
          alert(this.refs.ref2.value);
        };
        render() {
          return (
            <div>
              <input
                ref="ref1"
                id="input1"
                type="text"
                placeholder="点击按钮提示"
              />
              <button onClick={this.showData}>提示</button>
              <input
                ref="ref2"
                onBlur={this.blurData}
                type="text"
                placeholder="失去焦点提示"
              />
            </div>
          );
        }
      }

      ReactDOM.render(<Demo />, document.getElementById("app"));
    </script>
  </body>
</html>
